package com.qf.test2;

import com.github.pagehelper.PageInfo;
import com.qf.domain2.Student;
import com.qf.service2.StudentServcie;
import com.qf.service2.impl.StudentServiceImpl;
import com.qf.service2.impl.StudentServiceImpl2;
import org.junit.Test;

import java.util.List;

public class StudentServiceTest2 {

    private StudentServcie studentServcie = new StudentServiceImpl2();

    @Test
    public void testFindAll(){
        List<Student> students = studentServcie.findAll();

        students.forEach(System.out::println);
    }

    @Test
    public void testFindPage(){
        PageInfo<Student> pageInfo = studentServcie.findPage(2,2);

        long total = pageInfo.getTotal();
        int pageNum = pageInfo.getPageNum();
        int prePage = pageInfo.getPrePage();
        int nextPage = pageInfo.getNextPage();

        System.out.println("total:" + total);
        System.out.println("pageNum:" + pageNum);
        System.out.println("prePage:" + prePage);
        System.out.println("nextPage:" + nextPage);

        List<Student> students = pageInfo.getList();
        students.forEach(System.out::println);
    }
}
